package com
import(
	"github.com/bugfan/logrus"    
	// "github.com/bugfan/logrus/hooks/file"  
	"github.com/bugfan/to"    	
)
type EmptyWriter struct {
}

func (self *EmptyWriter) Write(p []byte) (n int, err error) {
	// nothing to do
	return len(p), nil
}
type LogrusWriter struct {
}
func (self *LogrusWriter) Write(p []byte) (n int, err error) {
	logrus.Infof(string(p))
	return len(p), nil
}
var (
	DEBUG bool
)
func init(){
	logrus.SetLevel(logrus.InfoLevel)
	// logrus.AddHook(file.NewHook("log/websocket.txt"))
	DEBUG=to.Bool(Conf.GetString("DEBUG"))
    if !DEBUG {
		logrus.SetOutput(&EmptyWriter{})
	}
}